<!DOCTYPE html>
<html lang="zh-hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}首页{% endblock %}</title>
    <style>
        nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
            background-color: #f0f0f0;
        }
        nav ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            display: flex;
        }
        nav ul li {
            margin-left: 20px;
        }
        nav ul li a {
            text-decoration: none;
            color: #333;
        }
    </style>
</head>
<body>
    <nav>
        <div>
            <a href="{% url 'index' %}">首页</a>
        </div>
        <ul>
            {% if user.is_authenticated %}
                <li><a href="{% url 'profile' %}">{{ user.username }}</a></li>
                <li><a href="{% url 'logout' %}">退出登录</a></li>
            {% else %}
                <li><a href="{% url 'login' %}">登录</a></li>
                <li><a href="{% url 'register' %}">注册</a></li>
            {% endif %}
        </ul>
    </nav>
    <main>
        {% block content %}
        {% endblock %}
    </main>
</body>
</html>
